<template>
	<view class="flex_row" style="flex-wrap: wrap;">
		<view style="position: relative;" v-for="(item,index) in list">
			<view v-if="clear"><view class="clear_btn" @click.stop="del(index)" v-if="item!=''">×</view></view>
			<uploadImg style="margin: 0 10rpx 10rpx 0;" :url="item" :clear="false" @update="upload_edit($event,index)" />
		</view>
		<uploadImg style="margin: 0 10rpx 10rpx 0;" @update="upload" />
	</view>
</template>

<script>
import uploadImg from "./uploadImg.vue"
export default {
	components:{
		uploadImg
	},
	props: {
		list: {
			type: Array,
			default: () => {
				return []
			}
		},
		clear: {
			default: true
		}
	},
	data() {
		return {
			
		};
	},
	methods: {
		del(i){
			this.upload_edit('',i)
		},
		upload_edit(url,index){
			this.$emit('update', url,index);
		},
		upload(url){
			this.$emit('update', url,-1);
		}
	}
};
</script>

<style lang="scss">
 .clear_btn{
 	font-family: simhei;
 	position: absolute;
 	right: 20rpx;
 	top: 10rpx;
 	width: 35rpx;
 	line-height: 35rpx;
 	text-align: center;
 	border-radius: 50%;
 	color: #fff;
 	background: #FF0000;
 	z-index: 10;
 	font-size: 30rpx;
 }
</style>
